<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>采购产品信息参考</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript" src="/jeesite/static/jquery-tablesorter/jquery.tablesorter.js"></script>
	<link href="/jeesite/static/jquery-tablesorter/themes/blue/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript">
		$(document).ready(function() {
			
			//导出提示
			$("#btnExport").click(function(){
				top.$.jBox.confirm("确认要导出产品数据吗？","系统提示",function(v,h,f){
					if(v=="ok"){
						$("#searchForm").attr("action","${ctx}/pro/productRef/export");
						$("#searchForm").submit();
					}
				},{buttonsFocus:1});
				top.$('.jbox-body .jbox-icon').css('top','55px');
			});
			//导入提示
			$("#btnImport").click(function(){
				$.jBox($("#importBox").html(), {title:"导入数据", buttons:{"关闭":true}, 
					bottomText:"导入文件不能超过5M，仅允许导入“xls”或“xlsx”格式文件！"});
			});
			
			//全选
			$("#checkAll").click(function() {
				$('input[name="id"]').attr("checked",this.checked);
			});
			var $subBox = $("input[name='id']");
			$subBox.click(function() {
				$("#checkAll").attr("checked",$subBox.length == $("input[name='id']:checked").length ? true : false);
			});
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").attr("action","${ctx}/pro/productRef/list");
			$("#searchForm").submit();
        	return false;
        }
		
		//删除
		function deleteData() {
			var $id = $("input[name='id']:checked");
			var ids = new Array();
			var j = 0;
			if ($id.val() != null && $id.val() != '') {
				var submit = function (v, h, f) {
				    if (v == 'ok'){
				        $id.each(function(i, info) {
							ids[j] = info.value;
							j++;
						});
				        resetTip();
				        location.href = "${ctx}/pro/productRef/deleteData?ids="+ ids;
				    }else if (v == 'cancel'){
				    	return true;
				    }
				};
				$.jBox.confirm("确认删除此信息吗？", "提示", submit);
			}else{
				jBox.tip("请勾选需要删除的数据！");
			}
		}
	</script>
</head>
<body class="fixed-top">
	<div class="container" style="width: 100%;">
		<div style="margin: 20px; border: 1px solid #c8d1d5;">
			<div id="importBox" class="hide">
				<form id="importForm" action="${ctx}/pro/productRef/import" method="post" enctype="multipart/form-data"
					class="form-search" style="padding-left:20px;text-align:center;" onsubmit="loading('正在导入，请稍等...');"><br/>
					<input id="uploadFile" name="file" type="file" style="width:330px"/><br/><br/>　　
					<input id="btnImportSubmit" class="btn btn-primary" type="submit" value="   导    入   "/>
					<a href="${ctx}/pro/productRef/import/template">下载模板</a>
				</form>
			</div>
			<div style="padding: 13px; background-color: #f4f4f4; border-bottom: 1px solid #c8d1d5;">
				<h4>
					<i class="icon-globe"></i> 采购产品管理
				</h4>
				<ul class="ul-form" style="float: right; margin-top: -25px;">
					<li style="list-style: none">
					<shiro:hasPermission name="pro:productRef:edit">
						<a class="btn btn-primary" href="${ctx}/pro/productRef/form"> 
						<i class="icon-pencil"></i>&nbsp;新增</a> 
						<a class="btn btn-danger" href="javascript:void(0)" onclick="deleteData()"> 
						<i class="icon-trash"></i>&nbsp;删除</a> 
					</shiro:hasPermission>	
						<a class="btn btn-info" href="javascript:void(0)" id="btnImport">
							<i class="icon-upload"></i>&nbsp;导入 </a> 
						<a class="btn btn-info" href="javascript:void(0)" id="btnExport">
							<i class="icon-download"></i>&nbsp;导出 </a>
					</li>
				</ul>
			</div>
			<div style="margin: 17px;">
				<form:form id="searchForm" modelAttribute="productRef" action="${ctx}/pro/productRef/" method="post" class="breadcrumb form-search">
					<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}" />
					<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}" />
					<ul class="ul-form">
					<li><label style="width: 150px;">产品编号：</label>
							<form:input path="codeNum" htmlEscape="false" maxlength="64" class="input-medium"/>
						</li>
						<li><label>产品名称：</label>
							<form:input path="name" htmlEscape="false" maxlength="64" class="input-medium"/>
						</li>
						<li><label>规格型号：</label>
							<form:input path="specifications" htmlEscape="false" maxlength="64" class="input-medium"/>
						</li>
						<li><label >产品代码：</label>
							<form:input path="productCode" htmlEscape="false" maxlength="64" class="input-medium"/>
						</li>
						<li class="clearfix"></li>
						<li><label style="width: 150px;">供应商：</label>
							<form:input path="suplierName" class="input-medium"/>
						</li>
						<li><label>产品类型：</label>
							<form:input path="productTypeName" class="input-medium"/>
						</li>
						<li class="btns">
							<a class="btn btn-primary"
							href="javascript:void(0)" onclick="return page();"><i
								class="icon-search"></i>&nbsp;搜索</a>
						</li>
					
						<li class="clearfix"></li>
					</ul>				
				</form:form>
				<sys:message content="${message}" />
				<table id="contentTable" class="table table-hover table-bordered" style="word-wrap:break-all;word-break:break-all;">
					<thead>
						<tr>
							<th style="width: 8px;white-space: normal;"><input type="checkbox" class="group-checkable" id="checkAll" /></th>
							<th style="white-space: normal;">产品编号</th>
							<th style="white-space: normal;">产品名称</th>
							<th style="white-space: normal;">供应商</th>
							<th style="white-space: normal;">产品类型</th>
							<th style="white-space: normal;">产品代码</th>
							<th style="white-space: normal;">规格</th>
							<th style="white-space: normal;">品牌</th>
							<th style="white-space: normal;">封装</th>
							<th style="white-space: normal;">计量单位</th>
							<th style="white-space: normal;">单价</th>
							<th style="white-space: normal;">备注</th>
							<shiro:hasPermission name="pro:productRef:edit"><th style="white-space: normal;">操作</th></shiro:hasPermission>
						</tr>
					</thead>
					<tbody>
					<c:forEach items="${page.list}" var="info">
						<tr>
							<td style="width: 8px;"><input type="checkbox" name="id" class="group-checkable" value="${info.id}" /></td>
							<td style="white-space: normal;">${info.codeNum }</td>
							<td style="white-space: normal;">${info.name }</td>
							<td style="white-space: normal;">${info.suplierName}</td>
							<td style="white-space: normal;">${info.productTypeName}</td>
							<td style="white-space: normal;">${info.productCode}</td>
							<td style="white-space: normal;">${info.specifications}</td>
							<td style="white-space: normal;">${info.brand}</td>
							<td style="white-space: normal;">${info.packaging}</td>
							<td style="white-space: normal;">${info.unitName}</td>
							<td style="white-space: normal;">${info.price}</td>
							<td style="white-space: normal;">${info.remarks}</td>
							<shiro:hasPermission name="pro:productRef:edit">
									<td style="white-space: normal;"><a href="${ctx}/pro/productRef/form?id=${info.id}"><i class="icon-edit"></i></a>
										<a href="${ctx}/pro/productRef/delete?id=${info.id}"
										onclick="return confirmx('确认要删除该吗？', this.href)"><i class="icon-remove"></i></a> 
									</td>
								</shiro:hasPermission>
							</tr>
						</c:forEach>
					</tbody>
				</table>
				<div class="pagination">${page}</div>
			</div>
		</div>
	</div>
</body>


</html>